package main

import (
	"fmt"
	"sort"
)

func main() {
	//a := [5]int{1, 2, 3, 4, 5}
	//s := a[1:3]  // s := a[low:high]
	//fmt.Printf("s:%v len(s):%v cap(s):%v\n", s, len(s), cap(s))
	//s2 := s[3:4]  // 索引的上限是cap(s)而不是len(s)
	//fmt.Printf("s2:%v len(s2):%v cap(s2):%v\n", s2, len(s2), cap(s2))
	//a:=[5]int{1,2,3,4,5}
	//t:=a[1:3:3]
	//fmt.Printf("t:%v len(t):%v cap(t):%v\n",t,len(t),cap(t))
	//a:=make([]int,2,10)
	//a[1]=3
	//b:=a
	//b[0]=1
	//fmt.Printf("%v len(a):%d cap(a) %d ptr:%p\n",a,len(a),cap(a),a)
	//fmt.Printf("%v len(a):%d cap(a) %d ptr:%p\n",b,len(b),cap(b),b)
	//var numSlice []int
	//for i:=0;i<1025;i++ {
	//	numSlice = append(numSlice, i)
	//	fmt.Printf("cap:%d ptr:%p\n",cap(numSlice), numSlice)
	//}
	//a:=[]int{1,2,3,4,5}
	//b:=make([]int,5,6)
	////b[1]=1
	////b[2]=1
	////b[3]=1
	////b[4]=1
	////var b = []int{}
	////c:=copy(b,a)
	//fmt.Println(a)
	//fmt.Println(b)
	//fmt.Println(c)
	//var a = make([]string, 5, 10)
	//for i := 0; i < 10; i++ {
	//	fmt.Printf("%v\n", a)
	//	a = append(a, fmt.Sprintf("%v", i))
	//}
	//fmt.Println(a)
	a := [...]int{3, 7, 8, 9, 1} //会改变底层数组
	b := a[1:5]
	sort.Ints(b)
	fmt.Printf("%v %T %p %v %T %p\n", a, a, a, b, b, b)
}
